from google.appengine.ext import webapp
from google.appengine.ext import db
from google.appengine.ext.webapp.util import run_wsgi_app
import simplejson as json
import createDB

#Getting the current version of the DB
class getVersion(webapp.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        Versions = db.GqlQuery("SELECT * from DBVersion")
        result = [{'number': Version.number} for Version in Versions]
        
          
        self.response.out.write(json.dumps(result))
        
application = webapp.WSGIApplication([('/getVersion', getVersion)], debug=True)
  
def main():
    run_wsgi_app(application)
    
if __name__ == "__main__":
    main()